<?php

namespace App\Http\Controllers\Common;

use App\Http\Controllers\BaseController;
use App\Http\Validate\AppCrash\AppCrashValidate;
use App\Service\AppCrash\AppCrashService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class AppCrashController extends BaseController
{
    /**
     * @param Request $request
     * @return JsonResponse
     * @throws ValidationException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function upload(Request $request): JsonResponse
    {
        $params = AppCrashValidate::uploadValidate($request->all());
        AppCrashService::upload($params);
        return $this->success();
    }
}
